<?php

namespace app\index\model;

use think\Model;

class Nav extends Model
{
    public function navs()
    {
        return $this->hasMany('Nav', 'pid', 'id');
    }

    public function get_all()
    {
        $items = self::with('navs')->wherePid(null)->select();
        return $items;
    }
}
